import network



def demo():
    # 定义全局变量
    eth = network.LAN()
    if not eth.isconnected():
        print("Connecting to eth...")
        eth.ifconfig(('192.168.3.100', '255.255.255.0', '192.168.3.1', '192.168.3.1'))
        eth.config(mac=b'\xe4\xba\xba\xe7\x94\x9f')
        eth.active(True)
        # 循环等待直到连接成功
        while not eth.isconnected():
            pass
        print('''status:{}\nifconfig:{}\n'''.format(eth.status(),eth.ifconfig()))


        
if __name__ == '__main__':
    demo()



